export default {
    namespaced: true,
    state:{
        user:{
            id:"",
            username:"",
            emial:"",
            avatar:"",
            sex:"",
            token:""
        }
    },
    mutations:{
        setUser(state,data){
            state.user = data.userInfo;
            state.user.token = data.token;
            state.user.sex = data.userInfo.sex.toString()
        },
        // 清空用户信息
        setUserNull(state) {
            state.user = {
                id: "",
                username: "",
                email: "",
                avatar: "",
                sex: "",
                token: "",
            };
        },
    }
}